<?php 
	if(isset($article) && $article == true)
	{
		$addAttribute = "article_id";
	}
	else
	{
		$addAttribute = "product_id";
	}
	$commentCount = count($comments);
	$commentIndex = 1;
	
	$monthNames = false;
	if(isset($_SESSION["language"]["month_names"]) && $_SESSION["language"]["month_names"] != "")
	{
		$monthNames = json_decode($_SESSION["language"]["month_names"], true);
	}
?>
<button type="button" class="btn btn-default btn-success center-align" id="addComment" title="<?php echo translate("button_add_comment"); ?>" <?php echo $addAttribute; ?>="<?php echo $page["id"]; ?>">
	<span class="glyphicon glyphicon-plus"></span>&nbsp; <?php echo translate("button_add_comment"); ?>
</button>
<?php if($commentCount == 0): ?>
	<div class="alert alert-warning"><?php echo translate("no_comments_yet");?></div>
<?php endif; ?>
<br />
<?php foreach($comments as $comment): ?>
	<div>
		<span class="glyphicon glyphicon-envelope"></span>&nbsp;<span><?php echo $comment["name"]; ?></span>&nbsp;
		<?php
			if($monthNames)
			{
				$monthName = $monthNames[date("n", $comment["date"])];
			}
			else
			{
				$monthName = date("F", $event["date"]);
			}
			
			$date = date("d", $comment["date"]) . " " . $monthName . " " . date("Y", $comment["date"]);

		?>
		<span class="glyphicon glyphicon-calendar"></span>&nbsp;<span><?php echo $date; ?></span>
		<p><?php echo $comment["content"]; ?></p>
	</div>
	<?php if($commentIndex < $commentCount):?>
		<hr />
	<?php endif; $commentIndex++;?>
<?php endforeach; ?>